#coding=utf-8

class Singleton(object):
##    __instance = None
    
##    def __new__(cls, *args, **kwd):
##        if cls.__instance is None:
##            for i in range(len(cls.__bases__)):
##                cls.__instance = cls.__bases__[i].__new__(cls, *args, **kwd)
##            return cls.__instance
##        else:
##            return None 
        
##    def __del__(self):
##        type(self).__instance = None

     def __new__(cls, *args, **kw):  
        if not hasattr(cls, '_instance'):  
            orig = super(Singleton, cls)  
            cls._instance = orig.__new__(cls, *args, **kw)  
        return cls._instance  